using KL.Standard.Domain.Mongo;
using KL.Standard.Model.ViewModels.OutResult;
using MongoDB.Bson;
using MongoDB.Driver;

namespace KL.Standard.Mongo.Repositories
{
    public class BaseArchLogRepository:BMongoRepository<LogCompareResultVM>,IBaseArchLogRepository
    {

        public int WriteChgLog(LogCompareResultVM log)
        {
            log._id= new ObjectId();
            var collection = Client.Database.GetCollection<LogCompareResultVM>("LOG_Field_CHG");
            collection.InsertOne(log);
            return 1;
        }

        public IList<LogCompareResultVM> GetChgLogs(string sysId, string moduleName)
        {
            var filterBuilder = Builders<LogCompareResultVM>.Filter;
            var filter = filterBuilder.And(filterBuilder.Eq("moduleName", moduleName) , filterBuilder.Eq("keyID", sysId));
            return this.Find("LOG_Field_CHG", filter,"BLD_DT");
        }
    }
}